#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int checkDiscardCard(int p, struct gameState *state) {

	int r, handCount, discardCount;

	handCount = state->handCount[p];
	discardCount = state->discardCount[p];

	r = discardCard(0, p, state, 0);
	assert(r == 0);
	assert(discardCount + 1 == state->discardCount[p]);
	assert(handCount - 1 == state->handCount[p]);

	r = discardCard(1, p, state, 1);
	assert(r == 0);
	assert(handCount - 2 == state->handCount[p]);
	assert(discardCount + 1 == state->discardCount[p]);
}

int main() {

	int r, p, discardCount, handCount, deckCount;
	int k[10] = {adventurer, council_room, feast, gardens, mine, remodel, smithy, village, baron, great_hall};

	struct gameState G;

	for (p = 0; p < 2; p++) {
		for (discardCount = 0; discardCount < 10; discardCount++) {
			for (handCount = 0; handCount < 10; handCount++) {
				memset(&G, 23, sizeof(struct gameState));
				r = initializeGame(2, k, 1, &G);
				G.discardCount[p] = discardCount;
				memset(&G, 0, sizeof(int) * discardCount);
				G.handCount[p] = handCount;
				memset(&G, 0, sizeof(int) * handCount);
				checkDiscardCard(p, &G);
			}
		}
	}
}
